import http from './request'
//这里配置不同服务器下的接口
var url = {
    login:`/adminLoginServlet`,//登录
    addCagetory:'/addCategoryServlet',//添加分类
    categoryList:'/getCagetoryList',//分类列表
    deleteCagetory:'/deleteCategoryServlet',//删除分类
    addBlog:'/addBlogServlet',//添加博客
    blogList:'/getBlogList',//博客列表
    deleteBlog:'/deleteBlogServlet',//删除
    checkBlog:'/checkBlogServlet',//审核
    recommed:'/recommBlogServlet',//推荐
    like:'/likeBlogServlet',//点赞
    colect:'//collectBlogServlet',//收藏
    userList:'/getUserListServlet',//用户列表
    backUser:'/addBackUserServlet',//加入黑名单
    addUser:'/addUserServlet',//添加用户
    deleteUser:'/deleteUserServlet',//删除用户
    setAdmin:'/setAdminUserServlet',//设为管理员
    updateUser:'/updateUserServlet',//更新用户
}
const API = {
    login(data){
        return http.post(url.login,data)
    },
    addCategory(data){
        return http.post(url.addCagetory,data)
    },
    getCategoryList(data){
        return http.get(url.categoryList,data)
    },
    deleteCagetory(data){
        return http.post(url.deleteCagetory,data)
    },
    addBlog(data){
        return http.post(url.addBlog,data)
    },
    getBlogList(data){
        return http.get(url.blogList,data)
    },
    deleteBlog(data){
        return http.post(url.deleteBlog,data)
    },
    checkBlog(data){
        return http.post(url.checkBlog,data)
    },
    recommedBlog(data){
        return http.post(url.recommed,data)
    },
    likeBlog(data){
        return http.post(url.colect,data)
    },
    colectBlog(data){
        return http.post(url.like,data)
    },
    getUserList(data){
        return http.get(url.userList,data)
    },
    addBackUser(data){
        return http.post(url.backUser,data) 
    },
    addUser(data){
        return http.post(url.addUser,data) 
    },
    deleteUser(data){
        return http.post(url.deleteUser,data)
    },
    setAdmin(data){
        return http.post(url.setAdmin,data)
    },
    updateUser(data){
        return http.post(url.updateUser,data)
    }
}
export default API